Skip to content

Move hardcoded error strings in GenerateJniRemappingNativeCode to Properties.Resources with XA error codes#11366

Merged
simonrozsival merged 4 commits into
mainfrom
copilot/fix-error-strings-in-jni-remapping
May 16, 2026
Merged

Move hardcoded error strings in GenerateJniRemappingNativeCode to Properties.Resources with XA error codes#11366
simonrozsival merged 4 commits into
mainfrom
copilot/fix-error-strings-in-jni-remapping

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 14, 2026

Three Log.LogError calls in GenerateJniRemappingNativeCode.cs used hardcoded interpolated strings with no XA#### error codes, violating repo convention for localizable, coded build errors.

Changes

  • Properties/Resources.resx: Added XA1045, XA1046, XA1047 with format-string placeholders and <comment> descriptions
  • Properties/Resources.Designer.cs: Added corresponding generated properties
  • GenerateJniRemappingNativeCode.cs: Replaced Log.LogErrorLog.LogCodedError at all three call sites
  • Documentation/docs-mobile/messages/xa1045.md, xa1046.md, xa1047.md: Added markdown documentation files for the new error codes
  • Documentation/docs-mobile/messages/index.md: Added XA1044XA1047 entries to the table of contents
// Before
Log.LogError ($"Input file `{remappingXmlFilePath}` does not start with `<replacements/>`");

// After
Log.LogCodedError ("XA1045", Properties.Resources.XA1045, remappingXmlFilePath);

Error codes assigned: XA1045 (invalid root element), XA1046 (unparseable boolean attribute), XA1047 (missing required attribute). These follow sequentially after the existing XA1044.

…perties.Resources with XA1045-XA1047 error codes

Agent-Logs-Url: https://github.com/dotnet/android/sessions/895d450d-8ee0-42ba-a920-784ef258ec94

Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix hardcoded error strings in GenerateJniRemappingNativeCode Move hardcoded error strings in GenerateJniRemappingNativeCode to Properties.Resources with XA error codes May 14, 2026
Copilot AI requested a review from jonathanpeppers May 14, 2026 22:48
@jonathanpeppers jonathanpeppers marked this pull request as ready for review May 14, 2026 22:54
Copilot AI review requested due to automatic review settings May 14, 2026 22:54
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aligns GenerateJniRemappingNativeCode with the repo’s build-error conventions by replacing three hardcoded Log.LogError messages with localized Properties.Resources entries and corresponding XA#### error codes.

Changes:

  • Added new localized error message resources XA1045XA1047 to Resources.resx (with format placeholders and comments).
  • Updated Resources.Designer.cs with the generated accessors for the new resource keys.
  • Replaced the three Log.LogError call sites with Log.LogCodedError using XA1045XA1047.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
src/Xamarin.Android.Build.Tasks/Tasks/GenerateJniRemappingNativeCode.cs Switches three uncoded errors to coded, localized Log.LogCodedError calls.
src/Xamarin.Android.Build.Tasks/Properties/Resources.resx Adds XA1045XA1047 localized messages with placeholders and argument documentation.
src/Xamarin.Android.Build.Tasks/Properties/Resources.Designer.cs Includes the generated resource properties for the new XA1045XA1047 keys.
Files not reviewed (1)
  • src/Xamarin.Android.Build.Tasks/Properties/Resources.Designer.cs: Language not supported

@jonathanpeppers
Copy link
Copy Markdown
Member

@copilot there are markdown files for each error code, and a table of contents. Can you update these for the new error codes?

…date index.md TOC

Agent-Logs-Url: https://github.com/dotnet/android/sessions/19a56121-fdbe-45d4-84be-ea0f62355b6b

Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 15, 2026

@copilot there are markdown files for each error code, and a table of contents. Can you update these for the new error codes?

Done in a63ec27. Added xa1045.md, xa1046.md, and xa1047.md under Documentation/docs-mobile/messages/, and updated index.md to include entries for XA1044–XA1047.

jonathanpeppers added a commit that referenced this pull request May 15, 2026
The close-older-issues: true setting was closing issues that already
had PRs in progress (e.g. #11365 closed while #11366 was active).
The expires: 7d setting already handles stale unclaimed issues.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jonathanpeppers jonathanpeppers added the ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable). label May 15, 2026
@simonrozsival simonrozsival merged commit 8054396 into main May 16, 2026
3 checks passed
@simonrozsival simonrozsival deleted the copilot/fix-error-strings-in-jni-remapping branch May 16, 2026 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[fix-finder] Move hardcoded error strings in GenerateJniRemappingNativeCode to Properties.Resources with XA error codes

4 participants